import Vue from 'vue'
import Axios from 'axios'
import VueAxios from 'vue-axios'
import ElementUI from 'element-ui'
import config from '@/config/baseUrl'
import 'element-ui/lib/theme-chalk/index.css'
import VueUeditorWrap from 'vue-ueditor-wrap' // ES6 Module
import App from './App'
import router from './router'
import store from './store'
import VideoPlayer from 'vue-video-player'
import VueClipboard from 'vue-clipboard2'
Vue.use( VueClipboard )
require('video.js/dist/video-js.css')
require('vue-video-player/src/custom-theme.css')
Vue.use(VideoPlayer)
// Vue.use(VueAxios, Axios);
Vue.use(ElementUI);
Vue.component('vue-ueditor-wrap', VueUeditorWrap)


router.beforeEach((to, from, next) => {

	let token = localStorage.getItem('token') || '';

 //    //配置接口信息
 //    Axios.defaults.baseURL = `${baseUrl}/admin/`;
 //    Axios.defaults.headers.common['X-Nideshop-Token'] = token;

	// if (!token && to.name !== 'login') {
	// 	console.log(to)
	// 	next({
	// 		path: '/login',
	// 		query: { redirect: to.fullPath }
	// 	})
	// } else {
		next()
	// }
});
router.afterEach((to, from, next) => {
    var routerList = to.matched
    store.commit('SET_CURRENT_MENU', to.fullPath)
})
Vue.prototype.$baseUrl = config.baseUrl
// if (!process.env.IS_WEB) {
//   Vue.use(require('vue-electron'))
// }
// Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    store,
    render: h => h(App)
})
